<UserControl x:Name="_root"
	x:Class="Intuipic.Navigation.Panel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:data="clr-namespace:Intuipic.Data"
	xmlns:local="clr-namespace:Intuipic"
	xmlns:nav="clr-namespace:Intuipic.Navigation"
	xmlns:con="http://schemas.kent.boogaart.com/converters" 
	xmlns:sys="clr-namespace:System;assembly=mscorlib"
	xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:kb="http://kent.boogaart/controls" 
	mc:Ignorable="PresentationOptions">
	<UserControl.Resources>
		<!-- converts between DisplayOrder and a string -->
		<con:MapConverter x:Key="DisplayOrderConverter">
			<con:Mapping From="{x:Static local:DisplayOrder.Ascending}" To="{StaticResource Ascending}"/>
			<con:Mapping From="{x:Static local:DisplayOrder.Descending}" To="{StaticResource Descending}"/>
			<con:Mapping From="{x:Static local:DisplayOrder.Random}" To="{StaticResource Random}"/>
		</con:MapConverter>

		<con:MapConverter x:Key="ThumbStrokeGradient1Converter">
			<con:Mapping>
				<con:Mapping.From>
					<sys:Boolean>True</sys:Boolean>
				</con:Mapping.From>
				<con:Mapping.To>
					<Color>#4a4f66</Color>
				</con:Mapping.To>
			</con:Mapping>
		</con:MapConverter>

		<con:MapConverter x:Key="ThumbStrokeGradient2Converter">
			<con:Mapping>
				<con:Mapping.From>
					<sys:Boolean>True</sys:Boolean>
				</con:Mapping.From>
				<con:Mapping.To>
					<Color>#4e5fd0</Color>
				</con:Mapping.To>
			</con:Mapping>
		</con:MapConverter>

		<con:MapConverter x:Key="ThumbStrokeGradient3Converter">
			<con:Mapping>
				<con:Mapping.From>
					<sys:Boolean>True</sys:Boolean>
				</con:Mapping.From>
				<con:Mapping.To>
					<Color>#6671a1</Color>
				</con:Mapping.To>
			</con:Mapping>
		</con:MapConverter>

		<con:MapConverter x:Key="ThumbFillGradient1Converter">
			<con:Mapping>
				<con:Mapping.From>
					<sys:Boolean>True</sys:Boolean>
				</con:Mapping.From>
				<con:Mapping.To>
					<Color>#8ee0f9</Color>
				</con:Mapping.To>
			</con:Mapping>
		</con:MapConverter>

		<con:MapConverter x:Key="ThumbFillGradient2Converter">
			<con:Mapping>
				<con:Mapping.From>
					<sys:Boolean>True</sys:Boolean>
				</con:Mapping.From>
				<con:Mapping.To>
					<Color>#255ace</Color>
				</con:Mapping.To>
			</con:Mapping>
		</con:MapConverter>

		<con:MapConverter x:Key="ThumbFillGradient3Converter">
			<con:Mapping>
				<con:Mapping.From>
					<sys:Boolean>True</sys:Boolean>
				</con:Mapping.From>
				<con:Mapping.To>
					<Color>#fdf4f5</Color>
				</con:Mapping.To>
			</con:Mapping>
		</con:MapConverter>
		
		<Thickness x:Key="TreeViewItemImageMargin">1</Thickness>
		<Thickness x:Key="TreeViewItemContentMargin">3 0 3 0</Thickness>

		<SolidColorBrush x:Key="NavigationButtonBorderBrush" Color="#00ffffff" PresentationOptions:Freeze="True"/>
		<SolidColorBrush x:Key="NavigationButtonMouseOverBorderBrush" Color="#e0ffffff" PresentationOptions:Freeze="True"/>
		<SolidColorBrush x:Key="NavigationButtonMouseOverBorderBackgroundBrush" Color="#8090dae8" PresentationOptions:Freeze="True"/>
		<SolidColorBrush x:Key="FoldersPopupBorderBrush" Color="#517681" PresentationOptions:Freeze="True"/>
		<SolidColorBrush x:Key="ToggleButtonCheckedBackgroundBrush" Color="#6090dae8" PresentationOptions:Freeze="True"/>

		<HierarchicalDataTemplate x:Key="TreeViewItemWithoutCheckboxDataTemplate" ItemsSource="{Binding Children}">
			<StackPanel Orientation="Horizontal">
				<Image Margin="{StaticResource TreeViewItemImageMargin}">
					<Image.Source>
						<MultiBinding Converter="{StaticResource TreeItemImageConverter}">
							<Binding/>
							<Binding Path="IsExpanded" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type TreeViewItem}}"/>
						</MultiBinding>
					</Image.Source>
				</Image>
				<TextBlock Text="{Binding Name}" VerticalAlignment="Center" Margin="{StaticResource TreeViewItemContentMargin}"/>
			</StackPanel>
		</HierarchicalDataTemplate>

		<HierarchicalDataTemplate x:Key="TreeViewItemWithCheckboxDataTemplate" ItemsSource="{Binding Children}">
			<StackPanel Orientation="Horizontal">
				<Image Margin="{StaticResource TreeViewItemImageMargin}">
					<Image.Source>
						<MultiBinding Converter="{StaticResource TreeItemImageConverter}">
							<Binding/>
							<Binding Path="IsExpanded" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type TreeViewItem}}"/>
						</MultiBinding>
					</Image.Source>
				</Image>
				<nav:InformationBaseCheckBox x:Name="_checkBox" VerticalAlignment="Center" Margin="{StaticResource TreeViewItemContentMargin}" Focusable="False"/>
				<TextBlock Text="{Binding Name}" VerticalAlignment="Center"/>
			</StackPanel>
		</HierarchicalDataTemplate>

		<Style x:Key="DesktopInformationStyle" TargetType="{x:Type TreeViewItem}">
			<Setter Property="IsExpanded" Value="True"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate>
						<Grid>
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto"/>
								<RowDefinition/>
							</Grid.RowDefinitions>
							<StackPanel Orientation="Horizontal">
								<Image Margin="{StaticResource TreeViewItemImageMargin}">
									<Image.Source>
										<MultiBinding Converter="{StaticResource TreeItemImageConverter}">
											<Binding/>
											<Binding Path="IsExpanded" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type TreeViewItem}}"/>
										</MultiBinding>
									</Image.Source>
								</Image>
								<TextBlock Text="{Binding Name}" VerticalAlignment="Center" Margin="{StaticResource TreeViewItemContentMargin}"/>
							</StackPanel>
							<ItemsPresenter Grid.Row="1"/>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="MyComputerInformationStyle" TargetType="{x:Type TreeViewItem}">
			<Setter Property="IsExpanded" Value="True"/>
		</Style>

		<Style x:Key="DirectoryInformationItemStyle" TargetType="{x:Type TreeViewItem}">
		</Style>

		<ControlTemplate x:Key="NavigationButtonTemplate">
			<Border x:Name="_border" BorderThickness="1" BorderBrush="{StaticResource NavigationButtonBorderBrush}" Background="{TemplateBinding Background}" CornerRadius="1">
				<ContentPresenter x:Name="_content" Margin="2" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" RecognizesAccessKey="True" Content="{TemplateBinding ContentControl.Content}" />
			</Border>
			<ControlTemplate.Triggers>
				<Trigger Property="IsMouseOver" Value="True">
					<Setter TargetName="_border" Property="BorderBrush" Value="{StaticResource NavigationButtonMouseOverBorderBrush}"/>
					<Setter TargetName="_border" Property="Background" Value="{StaticResource NavigationButtonMouseOverBorderBackgroundBrush}"/>
				</Trigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>

		<ControlTemplate x:Key="PausePlayButtonTemplate">
			<Border x:Name="_border" BorderThickness="1" BorderBrush="{StaticResource NavigationButtonBorderBrush}" Background="{TemplateBinding Background}" CornerRadius="5" Margin="5">
				<ContentPresenter x:Name="_content" Margin="3" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" RecognizesAccessKey="True" Content="{TemplateBinding ContentControl.Content}" />
			</Border>
			<ControlTemplate.Triggers>
				<Trigger Property="IsMouseOver" Value="True">
					<Setter TargetName="_border" Property="BorderBrush" Value="{StaticResource NavigationButtonMouseOverBorderBrush}"/>
					<Setter TargetName="_border" Property="Background" Value="{StaticResource NavigationButtonMouseOverBorderBackgroundBrush}"/>
				</Trigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>

		<Style x:Key="NavigationFocusVisualStyle">
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate>
						<Rectangle Stroke="White" StrokeThickness="1" StrokeDashArray="2 2"/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style TargetType="{x:Type StackPanel}" x:Key="ButtonsPanelStyle">
			<Setter Property="Margin" Value="0"/>
			<Setter Property="VerticalAlignment" Value="Top"/>
		</Style>

		<Style TargetType="{x:Type Button}">
			<Setter Property="Width" Value="20"/>
			<Setter Property="Height" Value="20"/>
			<Setter Property="Margin" Value="2"/>
			<Setter Property="Background" Value="#00ffffff"/>
			<Setter Property="Template" Value="{StaticResource NavigationButtonTemplate}"/>
			<Setter Property="FocusVisualStyle" Value="{StaticResource NavigationFocusVisualStyle}"/>
		</Style>

		<Style x:Key="ChromeButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
			<Setter Property="Width" Value="17"/>
			<Setter Property="Height" Value="17"/>
			<Setter Property="FocusVisualStyle" Value="{StaticResource NavigationFocusVisualStyle}"/>
		</Style>
		
		<Style TargetType="{x:Type ToggleButton}">
			<Setter Property="Width" Value="20"/>
			<Setter Property="Height" Value="20"/>
			<Setter Property="Margin" Value="2"/>
			<Setter Property="Background" Value="#00ffffff"/>
			<Setter Property="Template" Value="{StaticResource NavigationButtonTemplate}"/>
			<Setter Property="FocusVisualStyle" Value="{StaticResource NavigationFocusVisualStyle}"/>
			<Style.Triggers>
				<Trigger Property="IsChecked" Value="True">
					<Setter Property="Background" Value="{StaticResource ToggleButtonCheckedBackgroundBrush}"/>
				</Trigger>
			</Style.Triggers>
		</Style>

		<Style TargetType="{x:Type nav:FolderSelectionToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
		</Style>

		<Style x:Key="PausePlayButtonStyle" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
			<Setter Property="Width" Value="45"/>
			<Setter Property="Height" Value="45"/>
			<Setter Property="Margin" Value="0 -5 0 3"/>
			<Setter Property="Template" Value="{StaticResource PausePlayButtonTemplate}"/>
			<Style.Triggers>
				<Trigger Property="IsChecked" Value="True">
					<Setter Property="Background" Value="{x:Null}"/>
				</Trigger>
			</Style.Triggers>
		</Style>

		<Style x:Key="ChromeToggleButtonStyle" TargetType="{x:Type ToggleButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
			<Setter Property="Width" Value="17"/>
			<Setter Property="Height" Value="17"/>
		</Style>

		<Style TargetType="{x:Type Slider}">
			<Setter Property="Width" Value="70"/>
			<Setter Property="Margin" Value="5"/>
			<Setter Property="FocusVisualStyle" Value="{StaticResource NavigationFocusVisualStyle}"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate>
						<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
							
							<Grid>
								<Viewbox Height="8" Stretch="Fill" Margin="3">
									<Image>
										<Image.Source>
											<DrawingImage>
												<DrawingImage.Drawing>
													<!-- generated from Illustrator but then modified to include bindings and freezing -->
													<DrawingGroup>
														<DrawingGroup.Children>
															<GeometryDrawing Geometry="F1 M 124.625000,31.492188 C 124.625000,34.253418 122.386719,36.492188 119.625000,36.492188 L 5.000000,36.492188 C 2.238770,36.492188 0.000000,34.253418 0.000000,31.492188 L 0.000000,31.492188 C 0.000000,28.730957 2.238770,26.492188 5.000000,26.492188 C 5.000000,26.492188 78.916016,15.917480 87.250000,13.492188 C 104.476563,8.479004 115.535156,0.734375 119.937500,0.054688 C 124.428711,-0.638672 124.654297,5.477539 124.665039,5.909180 C 124.666016,5.951172 124.625000,31.450195 124.625000,31.492188 L 124.625000,31.492188 Z">
																<GeometryDrawing.Brush>
																	<LinearGradientBrush EndPoint="1,0">
																		<LinearGradientBrush.GradientStops>
																			<GradientStop Offset="0" Color="#ff676870" PresentationOptions:Freeze="True"/>
																			<GradientStop Offset="0" Color="#ffffffff" PresentationOptions:Freeze="True"/>
																			<!-- the bindings below provide an animation that indicates how long until the current image changes -->
																			<GradientStop Offset="{Binding RatioOfCurrentPeriodComplete, ElementName=_timer, Converter={StaticResource SliderGradientConverter}}" Color="#ffffffff"/>
																			<GradientStop Offset="{Binding RatioOfCurrentPeriodComplete, ElementName=_timer, Converter={StaticResource SliderGradientConverter}}" Color="#ff676870"/>
																			<GradientStop Offset="1" Color="#ff676870" PresentationOptions:Freeze="True"/>
																		</LinearGradientBrush.GradientStops>
																	</LinearGradientBrush>
																</GeometryDrawing.Brush>
															</GeometryDrawing>
														</DrawingGroup.Children>
													</DrawingGroup>
												</DrawingImage.Drawing>
											</DrawingImage>
										</Image.Source>
									</Image>
								</Viewbox>

								<Track Name="PART_Track">
									<Track.DecreaseRepeatButton>
										<RepeatButton Command="Slider.DecreaseLarge" IsTabStop="False" Focusable="False">
											<RepeatButton.Template>
												<ControlTemplate>
													<Border Background="Transparent" />
												</ControlTemplate>
											</RepeatButton.Template>
										</RepeatButton>
									</Track.DecreaseRepeatButton>

									<Track.IncreaseRepeatButton>
										<RepeatButton Command="Slider.IncreaseLarge" IsTabStop="False" Focusable="False">
											<RepeatButton.Template>
												<ControlTemplate>
													<Border Background="Transparent" />
												</ControlTemplate>
											</RepeatButton.Template>
										</RepeatButton>
									</Track.IncreaseRepeatButton>

									<Track.Thumb>
										<Thumb>
											<Thumb.Template>
												<ControlTemplate>
													<Grid x:Name="_grid" VerticalAlignment="Center">
														<Ellipse Stretch="Uniform" StrokeThickness="1" MinHeight="14" MinWidth="14">
															<Ellipse.Stroke>
																<LinearGradientBrush EndPoint="0,1">
																	<LinearGradientBrush.GradientStops>
																		<GradientStop Offset="0.0" Color="{Binding IsMouseOver, ElementName=_grid, Converter={StaticResource ThumbStrokeGradient1Converter}, FallbackValue=#2a2f46}"/>
																		<GradientStop Offset="0.4" Color="{Binding IsMouseOver, ElementName=_grid, Converter={StaticResource ThumbStrokeGradient2Converter}, FallbackValue=#2e3fb0}"/>
																		<GradientStop Offset="1.0" Color="{Binding IsMouseOver, ElementName=_grid, Converter={StaticResource ThumbStrokeGradient3Converter}, FallbackValue=#465181}"/>
																	</LinearGradientBrush.GradientStops>
																</LinearGradientBrush>
															</Ellipse.Stroke>
															<Ellipse.Fill>
																<LinearGradientBrush EndPoint="0,1">
																	<LinearGradientBrush.GradientStops>
																		<GradientStop Offset="0.0" Color="{Binding IsMouseOver, ElementName=_grid, Converter={StaticResource ThumbFillGradient1Converter}, FallbackValue=#6ec0e9}"/>
																		<GradientStop Offset="0.4" Color="{Binding IsMouseOver, ElementName=_grid, Converter={StaticResource ThumbFillGradient2Converter}, FallbackValue=#053aae}"/>
																		<GradientStop Offset="1.0" Color="{Binding IsMouseOver, ElementName=_grid, Converter={StaticResource ThumbFillGradient3Converter}, FallbackValue=#dde4f5}"/>
																	</LinearGradientBrush.GradientStops>
																</LinearGradientBrush>
															</Ellipse.Fill>
														</Ellipse>
													</Grid>
												</ControlTemplate>
											</Thumb.Template>
										</Thumb>
									</Track.Thumb>
								</Track>
							</Grid>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="FoldersPopupStyle" TargetType="{x:Type Popup}">
			<Setter Property="AllowsTransparency" Value="True"/>
		</Style>

		<Style x:Key="FoldersPopupBorderStyle" TargetType="{x:Type Border}">
			<Setter Property="BorderThickness" Value="{StaticResource ControlMargin}"/>
			<Setter Property="BorderBrush" Value="{StaticResource FoldersPopupBorderBrush}"/>
			<Setter Property="CornerRadius" Value="0 2 2 2"/>
		</Style>
	</UserControl.Resources>

	<Grid DataContext="{Binding ElementName=_root}">
	
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto"/>
		</Grid.ColumnDefinitions>

		<!-- a component used to time image changes -->
		<local:Timer x:Name="_timer" TimeInTotalPeriod="{Binding Settings.Delay}" PeriodFinished="Next" IsExecuting="{Binding IsImageCyclingEnabled}"/>
		
		<Viewbox Stretch="Fill">
			<Image>
				<Image.Source>
					<DrawingImage Drawing="{StaticResource Outline}"/>
				</Image.Source>
			</Image>
		</Viewbox>

		<Grid IsSharedSizeScope="True" Margin="5 0 5 0">
		
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*" SharedSizeGroup="OuterGroup"/>
				<ColumnDefinition Width="*" SharedSizeGroup="InnerGroup"/>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition Width="*" SharedSizeGroup="InnerGroup"/>
				<ColumnDefinition Width="*" SharedSizeGroup="OuterGroup"/>
			</Grid.ColumnDefinitions>

			<StackPanel Grid.Column="0" Orientation="Horizontal" Style="{StaticResource ButtonsPanelStyle}">
				<!-- pinned / unpinned -->
				<ToggleButton IsChecked="{Binding Settings.PinOptions}" Style="{StaticResource ChromeToggleButtonStyle}">
					<ToggleButton.ToolTip>
						<nav:ToolTip Text="Pins or unpins this options window."/>
					</ToggleButton.ToolTip>
					<ContentControl Focusable="False">
						<ContentControl.Template>
							<ControlTemplate TargetType="{x:Type ContentControl}">
								<Image x:Name="_image">
									<Image.Source>
										<DrawingImage Drawing="{StaticResource Unpinned}"/>
									</Image.Source>
								</Image>
								<ControlTemplate.Triggers>
									<DataTrigger Binding="{Binding IsChecked, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ToggleButton}}}" Value="True">
										<Setter TargetName="_image" Property="Source">
											<Setter.Value>
												<DrawingImage Drawing="{StaticResource Pinned}"/>
											</Setter.Value>
										</Setter>
									</DataTrigger>
								</ControlTemplate.Triggers>
							</ControlTemplate>
						</ContentControl.Template>
					</ContentControl>
				</ToggleButton>

				<!-- information -->
				<Button Command="local:Commands.Information" Style="{StaticResource ChromeButtonStyle}">
					<Button.ToolTip>
						<nav:ToolTip Text="Shows information about this application." Command="local:Commands.Information"/>
					</Button.ToolTip>
					<Image>
						<Image.Source>
							<DrawingImage Drawing="{StaticResource Information}"/>
						</Image.Source>
					</Image>
				</Button>
			</StackPanel>

			<StackPanel Grid.Column="1" Orientation="Horizontal" Style="{StaticResource ButtonsPanelStyle}" HorizontalAlignment="Right">
				<!-- folders -->
				<nav:FolderSelectionToggleButton x:Name="_foldersToggleButton" IsChecked="{Binding IsFolderSelectionOpen, Mode=OneWay}" Command="local:Commands.ChooseFolders">
					<nav:FolderSelectionToggleButton.ToolTip>
						<nav:ToolTip Text="Allows you to select the sources from which images will be displayed." Command="local:Commands.ChooseFolders"/>
					</nav:FolderSelectionToggleButton.ToolTip>
					<Image>
						<Image.Source>
							<DrawingImage Drawing="{StaticResource SelectFolders}"/>
						</Image.Source>
					</Image>
				</nav:FolderSelectionToggleButton>

				<Popup x:Name="_foldersPopup" IsOpen="{Binding IsFolderSelectionOpen}" PlacementTarget="{Binding ElementName=_foldersToggleButton}" HorizontalOffset="1" VerticalOffset="-1" Opened="_foldersPopup_Opened" Closed="_foldersPopup_Closed" StaysOpen="False" Style="{StaticResource FoldersPopupStyle}" KeyDown="_foldersPopup_KeyDown" MouseDown="_foldersPopup_MouseDown">
					<Border Style="{StaticResource FoldersPopupBorderStyle}">
						<kb:Resizer VerticalAlignment="Top" Width="300" Height="400" MinWidth="100" MinHeight="100">
							<TreeView x:Name="_foldersTreeView" ItemsSource="{Binding DesktopInformation}" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" ItemContainerStyleSelector="{StaticResource FolderItemContainerStyleSelector}" ItemTemplateSelector="{StaticResource TreeViewItemTemplateSelector}"/>
						</kb:Resizer>
					</Border>
				</Popup>

				<!-- display order -->
				<Button Command="local:Commands.CycleDisplayOrder">
					<Button.ToolTip>
						<nav:ToolTip Text="Toggles between ascending, descending and random display order." Command="{x:Static local:Commands.CycleDisplayOrder}"/>
					</Button.ToolTip>
					<Image>
						<Image.Source>
							<DrawingImage Drawing="{Binding Settings.DisplayOrder, Mode=OneWay, Converter={StaticResource DisplayOrderConverter}}"/>
						</Image.Source>
					</Image>
				</Button>

				<!-- mark for deletion -->
				<ToggleButton Command="local:Commands.MarkAsDeleted" IsChecked="{Binding IsCurrentFileMarkedForDeletion}">
					<ToggleButton.ToolTip>
						<nav:ToolTip Text="Marks or unmarks the current image for deletion upon exit." Command="{x:Static local:Commands.MarkAsDeleted}"/>
					</ToggleButton.ToolTip>
					<Image>
						<Image.Source>
							<DrawingImage Drawing="{StaticResource MarkAsDeleted}"/>
						</Image.Source>
					</Image>
				</ToggleButton>

				<!-- previous -->
				<Button Command="local:Commands.Previous">
					<Button.ToolTip>
						<nav:ToolTip Text="Displays the previous image in the slideshow." Command="{x:Static local:Commands.Previous}"/>
					</Button.ToolTip>
					<Image>
						<Image.Source>
							<DrawingImage Drawing="{StaticResource Previous}"/>
						</Image.Source>
					</Image>
				</Button>
			</StackPanel>

			<!-- pause / play -->
			<ToggleButton Grid.Column="2" Command="local:Commands.PausePlay" Style="{StaticResource PausePlayButtonStyle}">
				<ToggleButton.ToolTip>
					<nav:ToolTip Text="Pauses or plays the slideshow." Command="local:Commands.PausePlay"/>
				</ToggleButton.ToolTip>
				<ContentControl Focusable="False">
					<ContentControl.Template>
						<ControlTemplate TargetType="{x:Type ContentControl}">
							<Image x:Name="_image">
								<Image.Source>
									<DrawingImage Drawing="{StaticResource Pause}"/>
								</Image.Source>
							</Image>
							<ControlTemplate.Triggers>
								<DataTrigger Binding="{Binding IsExecuting, ElementName=_timer}" Value="False">
									<Setter TargetName="_image" Property="Source">
										<Setter.Value>
											<DrawingImage Drawing="{StaticResource Play}"/>
										</Setter.Value>
									</Setter>
								</DataTrigger>
							</ControlTemplate.Triggers>
						</ControlTemplate>
					</ContentControl.Template>
				</ContentControl>
			</ToggleButton>

			<StackPanel Grid.Column="3" Orientation="Horizontal" Style="{StaticResource ButtonsPanelStyle}">
				<!-- next -->
				<Button Command="local:Commands.Next">
					<Button.ToolTip>
						<nav:ToolTip Text="Displays the next image in the slideshow." Command="{x:Static local:Commands.Next}"/>
					</Button.ToolTip>
					<Image>
						<Image.Source>
							<DrawingImage Drawing="{StaticResource Next}"/>
						</Image.Source>
					</Image>
				</Button>

				<!-- delay -->
				<Slider x:Name="_delaySlider" Grid.Row="1" SmallChange="0.5" LargeChange="2" Minimum="0.5" Maximum="20" Value="{Binding Settings.Delay, Converter={StaticResource DelayConverter}}">
					<Slider.ToolTip>
						<nav:ToolTip Text="Determines the rate at which images are changed in the slideshow.">
							<!-- need to show two gestures, so set the gesture text explicitly -->
							<nav:ToolTip.GestureText>
								<MultiBinding Mode="OneWay" Converter="{con:FormatConverter {}{0}\, {1}}">
									<Binding Path="InputGestures[0].DisplayString" Source="{x:Static local:Commands.IncreaseDelay}"/>
									<Binding Path="InputGestures[0].DisplayString" Source="{x:Static local:Commands.DecreaseDelay}"/>
								</MultiBinding>
							</nav:ToolTip.GestureText>
						</nav:ToolTip>
					</Slider.ToolTip>
				</Slider>
			</StackPanel>

			<StackPanel Grid.Column="4" Orientation="Horizontal" Style="{StaticResource ButtonsPanelStyle}">
				<!-- minimize -->
				<Button Command="local:Commands.Minimize" VerticalContentAlignment="Bottom" Style="{StaticResource ChromeButtonStyle}">
					<Button.ToolTip>
						<nav:ToolTip Text="Minimize."/>
					</Button.ToolTip>
					<Image>
						<Image.Source>
							<DrawingImage Drawing="{StaticResource Minimize}"/>
						</Image.Source>
					</Image>
				</Button>

				<!-- close -->
				<Button Command="local:Commands.Close" Style="{StaticResource ChromeButtonStyle}">
					<Button.ToolTip>
						<nav:ToolTip Text="Close." Command="{x:Static local:Commands.Close}"/>
					</Button.ToolTip>
					<Image>
						<Image.Source>
							<DrawingImage Drawing="{StaticResource Close}"/>
						</Image.Source>
					</Image>
				</Button>
			</StackPanel>
		</Grid>
	</Grid>
</UserControl>
